var app=getApp()
var host = app.data.host

//上传评论图片
function uploadImage(path, cb) {
  wx.uploadFile({
    url: host + "uploadImg",
    filePath: path,
    name: 'file',
    success: res => {
      var obj = JSON.parse(res.data)
      cb(obj.url)
    }
  })
}
//上传用户头像
function uploadAvatar(path, cb) {
  wx.uploadFile({
    url: host + "uploadAvatar",
    filePath: path,
    name: 'file',
    success: res => {
      var obj = JSON.parse(res.data)
      cb(obj.url)
    }
  })
}
module.exports={
  uploadImage: uploadImage,
  uploadAvatar: uploadAvatar,
}